<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'show.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<style type="text/css">
		#contrainer{
			width: 500px;
			height: 600px;
			margin: 0 auto;
		}
	</style>
  </head>
  
  <body>
  <div id="contrainer">
  	按区域查询:<select name="type"
					onChange="javacript:location.href='aqi/aqiAction!show?page.nowpage=1&type='+this.options[this.selectedIndex].value;">
					<option value="0" <s:if test="%{type==0 }">selected</s:if>>全部</option>
					<s:iterator value="list">
						<option value="<s:property value="id"/>"
							<s:if test="%{type==id }">selected</s:if>>
							<s:property value="name" />
						</option>
					</s:iterator>
				</select>
				<input type="button" value="增加地区" onclick="javascript:location.href='aqi/aqiAction!toAddDis?page.nowpage=${page.nowpage}'" />
				<input type="button" value="增加空气质量" onclick="javascript:location.href='aqi/aqiAction!toAddAqi'" />
				<input type="button" value="地区管理" onclick="javascript:location.href='aqi/aqiAction!disShow?page.nowpage=1&type=${type}&likename='" />
   	<table border="1px">
   		<tr>
   			<td style="width: 15%">序号</td>
   			<td style="width: 15%">区域</td>
   			<td style="width: 25%">检测时间</td>
   			<td style="width: 15%">PM10数据</td>
   			<td style="width: 15%">PM2.5数据</td>
   			<td style="width: 15%">检测站</td>
   		</tr>
   		<s:if test="page.getlist.size!=0">
	   		<s:iterator value="page.getlist">
	   			<tr>
		   			<td><a href="aqi/aqiAction!toModifyAqi?aqi.id=${id}&page.nowpage=${page.nowpage}&type=${type}">${id}</a></td>
		   			<td>${dis.name}</td>
		   			<td><s:date name="monitor_time" format="yyyy-MM-dd HH:mm:ss E" /></td>
		   			<td>${pm10}</td>
		   			<td>${pm2p5}</td>
		   			<td>${monitoring_station}</td>
	   			</tr>
	   		</s:iterator>
   		</s:if>
   		<s:if test="page.getlist.size==0">
	   			<tr>
		   			<td colspan="6"><h1><span>抱歉,暂无数据</span></h1></td>
	   			</tr>
   		</s:if>
   	</table>
   	<div>
				第${page.nowpage }页 共${page.allpage }页 <a
					href="aqi/aqiAction!show?type=${type}&page.nowpage=1">首页</a>
				<s:if test="%{page.nowpage>1 }">
					<a
						href="aqi/aqiAction!show?type=${type}&page.nowpage=${page.nowpage-1 }">上一页</a>
				</s:if>
				<s:if test="%{page.nowpage<=1 }">
					<a href="javascript:void(0)">上一页</a>
				</s:if>
				<s:if test="%{page.nowpage<page.allpage }">
					<a
						href="aqi/aqiAction!show?type=${type}&page.nowpage=${page.nowpage+1 }">下一页</a>
				</s:if>
				<s:if test="%{page.nowpage>=page.allpage }">
					<a href="javascript:void(0)">下一页</a>
				</s:if>
				<a
					href="aqi/aqiAction!show?type=${type}&page.nowpage=${page.allpage }">尾页</a>
				转至 <select name="select"
					onChange="javacript:location.href='aqi/aqiAction!show?type=${type}&page.nowpage='+this.options[this.selectedIndex].value;">
					<s:iterator var="p" begin="1" end="%{page.allpage }" status="st">
						<option value="<s:property value="#p"/>"
							<s:if test="%{page.nowpage==#p }">selected</s:if>>
							<s:property value="#p" />
						</option>
					</s:iterator>
				</select> 页
			</div>
	</div>
  </body>
</html>
